package 反射机制概述.获取Class的三种方式.Test01;

public class ReflectTest01 {
    public static void main(String[] args) {
        //第一种方法
        Class c1 = null;
        Class c3 = null;
        try {
            c1 = Class.forName("java.lang.String");
            c3 = Class.forName("java.lang.Integer");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        //第二种方法
        String s = "jojo";
        Class c2 = s.getClass();
        System.out.println(c1 == c2);//true
        
        Integer i = 10;
        Class c4 = i.getClass();
        System.out.println(c3 ==c4);//true
        //第三种方式
        Class c5 = Integer.class;
        System.out.println(c5 == c4);//true

    }
}
